<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('产品类别列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>产品名称：</label>
                                <input type="text" name="productName"/>
                            </li>
                            <li>
                                <label>命名规则：</label>
                                <input type="text" name="nameRule"/>
                            </li>
                            <li>
                                <label>产品类别：</label>
                                <select name="productType" class="form-control m-b" th:with="type=${@dict.getType('product_type')}">
                                    <option value="">---请选择---</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>发布单位：</label>
                                <select name="productDepartment" class="form-control m-b">
                                    <option value="">---请选择---</option>
                                    <option th:each="dept:${deptList}" th:text="${dept.deptName}" th:value="${dept.departcode}"></option>
                                </select>
<!--                                <input type="text" name="productDepartment"/>-->
                            </li>
                            <li>
                                <label>产品类型：</label>
                                <select name="productItem" class="form-control m-b">
                                    <option value="">---请选择---</option>
                                    <option th:each="type:${productTypes}" th:text="${type.productName}" th:value="${type.productCode}"></option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="product:product:add">
                    <i class="fa fa-plus"></i> 添加
                </a>

                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="product:product:edit">
                    <i class="fa fa-edit"></i> 编辑
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="product:product:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
<!--
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="product:product:export">
                    <i class="fa fa-download"></i> 导出
                </a>
-->
            </div>
            <div class="col-sm-12 select-table table-bordered">
                <!-- data-height="680" 参数用来固定表头和高度-->
                <table id="bootstrap-table" data-height="680" data-resizable="true"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
     <th:block th:include="include :: bootstrap-table-resizable-js" />
     <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('product:product:edit')}]];
        var removeFlag = [[${@permission.hasPermi('product:product:remove')}]];
        var detailFlag = [[${@permission.hasPermi('product:product:detail')}]];
        var prefix = ctx + "product/product";

        var productType = [[${@dict.getType('product_type')}]];
        var yesorno = [[${@dict.getType('yes_or_no')}]];
        $(function() {

            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                detailUrl: prefix + "/detail/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "产品类别",
                sortName: 'sortOrder',
                sortOrder: 'desc',
                pageSize:10,
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '',
                    visible: false,
                    ignore: true,

                },
                    {
                        field: 'sortOrder',
                        title: '排序',
                        sortable: true,
                        width:80,
                    },
                    {
                        field: 'productName',
                        title: '产品名称',
                        sortable: true,
                        width:80
                    },
                    {
                        field: 'nameRule',
                        title: '命名规则',
                        sortable: true,
                        width:80
                    },
                    {
                        field: 'fileType',
                        title: '文件格式',
                        sortable: true,
                        width:80
                    },
                    {
                        field: 'productType',
                        title: '产品类别',
                        sortable: true,
                        width:80,
                        formatter: function (value, row, index) {
                            return $.table.selectDictLabel(productType,value);
                        }
                    },
                    {
                        field: 'productDepartment',
                        title: '发布单位',
                        sortable: true,
                        width:80
                    },
                    {
                        field: 'forecastType',
                        title: '预报类型',
                        sortable: true,
                        width:80
                    },
                    {
                        field: 'productItem',
                        title: '产品类型',
                        sortable: true,
                        width:80
                    },
                    {
                        field: 'coverSeaArea',
                        title: '覆盖海区',
                        sortable: true,
                        width:80
                    },
                    {
                        field: 'forecastAging',
                        title: '预报实效',
                        sortable: true,
                        width:80
                    },
                    {
                        field: 'forecastElement',
                        title: '预报要素',
                        sortable: true,
                        width:80
                    },
                    {
                        field: 'modeName',
                        title: '产品模式',
                        sortable: true,
                        width:80,
                        formatter: function (value, row, index) {
                            if ("null" === value || "NULL" === value){
                                return "-";
                            }else {
                                return value;
                            }
                        }
                    },
                    {
                        field: 'resolution',
                        title: '分辨率',
                        sortable: true,
                        width:80
                    },
                    {
                        field: 'frequency',
                        title: '起报时间',
                        sortable: true,
                        width:80
                    },
                    {
                        field: 'isOpen',
                        title: '是否前端显示',
                        sortable: true,
                        width:80,
                        formatter: function (value, row, index) {
                            return $.table.selectDictLabel(yesorno,value);
                        }
                    },
                    {
                        field: 'fileSize',
                        title: '文件大小',
                        sortable: true,
                        width:80
                    },
                    {
                        field: 'isOpenThreshold',
                        title: '启用阈值',
                        sortable: true,
                        width:80,
                        formatter: function (value, row, index) {
                            return $.table.selectDictLabel(yesorno,value);
                        }
                    },
                    {
                        field: 'minSize',
                        title: '最小限制',
                        sortable: true,
                        width:80
                    },
                   /* {
                        field: 'leftUpLongitude',
                        title: '左下经度',
                        sortable: true,
                        width:80
                    },
                    {
                        field: 'leftUpLatitude',
                        title: '左下纬度',
                        sortable: true,
                        width:80
                    },
                    {
                        field: 'rightDownLongitude',
                        title: '右上经度',
                        sortable: true,
                        width:80
                    },
                    {
                        field: 'rightDownLatitude',
                        title: '右上纬度',
                        sortable: true,
                        width:80
                    },*/
                    {
                        field: 'isAuto',
                        title: '自动发布',
                        sortable: true,
                        width:80,
                        formatter: function (value, row, index) {
                            return $.table.selectDictLabel(yesorno,value);
                        }
                    },
                    /*{
                        field: 'isPreview',
                        title: '是否可预览',
                        sortable: true,
                        width:80,
                        formatter: function (value, row, index) {
                            return $.table.selectDictLabel(yesorno,value);
                        }
                    },*/
                    {
                        field: 'isUnzip',
                        title: '是否归档解压',
                        sortable: true,
                        width:80,
                        formatter: function (value, row, index) {
                            return $.table.selectDictLabel(yesorno,value);
                        }
                    },
                   /* {
                        field: 'isForeverSave',
                        title: '是否永久保存',
                        sortable: true,
                        width:80,
                        formatter: function (value, row, index) {
                            return $.table.selectDictLabel(yesorno,value);
                        }
                    },*/
                    {
                        field: 'isJoinHistory',
                        title: '是否检查更新',
                        sortable: true,
                        width:80,
                        formatter: function (value, row, index) {
                            return $.table.selectDictLabel(yesorno,value);
                        }
                    },
                    {
                        field: 'notUpdateCheckDays',
                        title: '检查更新天数',
                        sortable: true,
                        width:80
                    },
                    {
                        field: 'checkConfig',
                        title: '归档校验配置',
                        sortable: true,
                        width:80
                    },
                    {
                        field: 'lateTransmission',
                        title: '晚传时间设置',
                        sortable: true,
                        width:80
                    },
                    {
                        field: 'repairTransmission',
                        title: '补传时间设置',
                        sortable: true,
                        width:80
                    },
                    {
                        field: 'repairTipSmsDay',
                        title: '补传短信提醒日',
                        sortable: true,
                        width:80
                    },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                      /*  actions.push('<a class="btn btn-default btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa "></i>编辑</a> ');
*/                        actions.push('<a class="btn btn-default btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa "></i>删除</a>');
                        actions.push('<a class="btn btn-default btn-xs " href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa "></i>查看</a>');
                        actions.push('<a class="btn btn-default btn-xs " href="javascript:void(0)" onclick="productDept(\'' + row.id + '\')"><i class="fa "></i>使用单位</a>');
                        if ('nc' == row.fileType){
                            actions.push('<a class="btn btn-default btn-xs " href="javascript:void(0)" onclick="nc(\'' + row.id + '\',\''+row.resourcesId+ '\')"><i class="fa "></i>NC文件模板</a>');
                        }
          /*              actions.push('<a class="btn btn-default btn-xs " href="javascript:void(0)" onclick="openFiles(\'' + row.id + '\')"><i class="fa "></i>附件列表</a>');
                        actions.push('<a class="btn btn-default btn-xs " href="javascript:void(0)" onclick="openFiles(\'' + row.id + '\')"><i class="fa "></i>比测图片</a>');*/
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        function productDept(id) {
            $.modal.open('单位列表',prefix+'/updateProductDept?id='+id,400)
        }

        function nc(id,resourcesId) {
            $.modal.open("NC文件模板",'/metadata/metadata?id='+id+"&resourcesId="+resourcesId)
        }

         function openFiles(id) {
             $.modal.open(table.options.modalName + '详细',prefix+'/openFiles?id='+id)
/*
             var options = {
                 type: 2,
                 title: table.options.modalName + "详细",
                 width: '',
                 height: '',
                 url: prefix + "/openFiles?id="+id,
                 skin: 'layui-layer-gray',
                 btn: ['关闭'],
                 yes: function (index, layero) {
                     var iframeWin = layero.find('iframe')[0];
                     iframeWin.contentWindow.submitHandler(index,layero);
                     // $.modal.close(index);
                 },
                 success: function () {
                     $(':focus').blur()
                 }
             };
             $.modal.openOptions(options);
*/
         }
    </script>
</body>
<style>
 /*   table {
        table-layout: fixed; !* 只有定义了表格的布局算法为fixed，下面td的定义才能起作用。 *!
    }
    th{
        width: 80px!important;
    }
    table td {
        position: relative;
        height: 20px;
        text-align: center;
        font-weight: normal;

        width: 100%;
        word-break: keep-all; !* 不换行 *!
        white-space: nowrap; !* 不换行 *!
        overflow: hidden; !* 内容超出宽度时隐藏超出部分的内容 *!
        text-overflow: ellipsis; !* 当对象内文本溢出时显示省略标记(...) ；需与overflow:hidden;一起使用。*!
    }

    table td:hover {
        overflow: visible;!* 显示 *!
        white-space: normal;!* 允许文字自动换行 *!
        word-wrap: break-word;!* 文字自动换行 *!
    }*/
</style>
</html>
